﻿using System;

namespace Terraria.Map
{
	// Token: 0x0200031B RID: 795
	public struct MapTile
	{
		// Token: 0x1700020F RID: 527
		// (get) Token: 0x06001DD8 RID: 7640 RVA: 0x000151EA File Offset: 0x000133EA
		// (set) Token: 0x06001DD9 RID: 7641 RVA: 0x000151FF File Offset: 0x000133FF
		public bool IsChanged
		{
			get
			{
				return (this._extraData & 128) == 128;
			}
			set
			{
				if (value)
				{
					this._extraData |= 128;
					return;
				}
				this._extraData &= 127;
			}
		}

		// Token: 0x17000210 RID: 528
		// (get) Token: 0x06001DDA RID: 7642 RVA: 0x00015228 File Offset: 0x00013428
		// (set) Token: 0x06001DDB RID: 7643 RVA: 0x00015234 File Offset: 0x00013434
		public byte Color
		{
			get
			{
				return this._extraData & 127;
			}
			set
			{
				this._extraData = ((this._extraData & 128) | (value & 127));
			}
		}

		// Token: 0x06001DDC RID: 7644 RVA: 0x0001524E File Offset: 0x0001344E
		private MapTile(ushort type, byte light, byte extraData)
		{
			this.Type = type;
			this.Light = light;
			this._extraData = extraData;
		}

		// Token: 0x06001DDD RID: 7645 RVA: 0x00015265 File Offset: 0x00013465
		public bool Equals(ref MapTile other)
		{
			return this.Light == other.Light && this.Type == other.Type && this.Color == other.Color;
		}

		// Token: 0x06001DDE RID: 7646 RVA: 0x00015293 File Offset: 0x00013493
		public bool EqualsWithoutLight(ref MapTile other)
		{
			return this.Type == other.Type && this.Color == other.Color;
		}

		// Token: 0x06001DDF RID: 7647 RVA: 0x000152B3 File Offset: 0x000134B3
		public void Clear()
		{
			this.Type = 0;
			this.Light = 0;
			this._extraData = 0;
		}

		// Token: 0x06001DE0 RID: 7648 RVA: 0x000152CA File Offset: 0x000134CA
		public MapTile WithLight(byte light)
		{
			return new MapTile(this.Type, light, this._extraData | 128);
		}

		// Token: 0x06001DE1 RID: 7649 RVA: 0x000152E5 File Offset: 0x000134E5
		public static MapTile Create(ushort type, byte light, byte color)
		{
			return new MapTile(type, light, color | 128);
		}

		// Token: 0x0400192F RID: 6447
		public ushort Type;

		// Token: 0x04001930 RID: 6448
		public byte Light;

		// Token: 0x04001931 RID: 6449
		private byte _extraData;
	}
}
